#ifndef RECORD_DESKTOP_X11
#define RECORD_DESKTOP_X11

#include "record_desktop.h"
#if defined (__linux__)  && !defined(__ANDROID__)
#include <X11/cursorfont.h>
#include <X11/extensions/Xrender.h>
#include <X11/extensions/XShm.h>
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>


class record_desktop_x11 :
	public record_desktop
{
public:
    record_desktop_x11();
    ~record_desktop_x11();

	virtual int init(
		const Rect& rect,
		const int fps);

	virtual int start();
	virtual int pause();
	virtual int resume();
	virtual int stop();

protected:
	virtual void clean_up();

private:
    //void draw_cursor(HDC hdc);

	int do_record();


	void record_func();

	std::atomic_bool _draw_cursor;

    Display *deskdisplay;
    int      deskscreen;
    XImage *screen_image;
    XShmSegmentInfo shminfo;
};

#endif
#endif
